<template>
	<view class="home">
		<view class="top">
			<view class="nav">
				<navigator url="/pkg-house/house/house">
					<image src="../../static/icon/house.png"></image>
					<text>我的房屋</text>
				</navigator>
				<navigator url="/pkg-house/house-repair/house-repair">
					<image src="../../static/icon/在线报修.png"></image>
					<text>在线报修</text>
				</navigator>
				<navigator>
					<image src="../../static/icon/访客邀请.png"></image>
					<text>访客邀请</text>
				</navigator>
			</view>
			<image class="banner" src="../../static/icon/banner.png"></image>
		</view>
		<view class="msg">
			<view class="title">
				<image src="../../static/icon/社区公告.png"></image>
				<text>社区</text>
				<text>公告</text>
			</view>

			<view class="list">
				<community-item :url="'/pages/community-detail/community-detail?id=' + item.id" :title="item.title"
					:info="item.content" :pub_date="item.createdAt" v-for="item in list" :key="item.id">
				</community-item>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getCommunityList
	} from '../../api/home'
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.initCommunityList()
		},
		methods: {
			async initCommunityList() {
				const res = await getCommunityList()
				console.log(res)
				this.list = res.data
			}
		}
	}
</script>

<style lang="scss" scoped>
	.home {
		.top {
			width: 750rpx;
			height: 448rpx;
			background-color: #D2DDE8;
			overflow: hidden;

			.nav {
				width: 670rpx;
				height: 164rpx;
				background-color: #fff;
				border-radius: 16rpx;
				margin: 25rpx auto;
				display: flex;

				navigator {
					flex: 1;
					display: flex;
					flex-direction: column;
					justify-content: center;
					align-items: center;

					image {
						width: 60rpx;
						height: 60rpx;
					}

					text {
						font-size: 24rpx;
						color: #686868;
						margin-top: 14rpx;
					}
				}
			}

			.banner {
				width: 670rpx;
				height: 240rpx;
				display: block;
				margin: 0 auto;
				position: relative;
				// z-index: 2;
			}
		}

		.msg {
			height: 300rpx;
			border-radius: 30rpx;
			background-color: #FBFBFF;
			margin-top: -58rpx;
			padding: 0 40rpx;

			.title {
				padding-top: 99rpx;

				image {
					width: 48rpx;
					height: 40rpx;
					margin-right: 10rpx;
				}

				text {
					font-size: 36rpx;

					&:nth-child(2) {
						color: #333333;
					}

					&:nth-child(3) {
						color: #E2973E;
					}
				}
			}


		}
	}
</style>
